package com.sg.java.apps;

import com.sg.java.PropertiesUtil;
import com.sg.java.ResourcePath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

import java.io.IOException;
import java.util.Properties;

/**
 * @author lhy
 * @data 2022/8/2 18:07
 */
public class GxInit {
    private static final Logger log = LoggerFactory.getLogger(GxInit.class);


    public static void main(String[] args) {
        Properties redisProp = PropertiesUtil.createAndLoadPropertiesFromFileOrResource(null, ResourcePath.redis_properties);
        log.info("redis配置：" + redisProp.toString());
        try (
                Jedis jedis = new Jedis(redisProp.getProperty("host"), Integer.parseInt(redisProp.getProperty("port")), 1000 * 60)

        ) {
            jedis.auth(redisProp.getProperty("password"));
            //开通管道
            Pipeline jp = jedis.pipelined();
            jedis.select(0);

            redisSetAc(jp);

            jp.sync();
            try {
                jp.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }


    private static void redisSetAc(Pipeline jp) {
        //#220v
        jp.hset("acMap", "AC02202U", "235.4");
        jp.hset("acMap", "AC02202D", "198");
        //#380v
        jp.hset("acMap", "AC03802U", "406.6");
        jp.hset("acMap", "AC03802D", "342");
        //#6kv
        jp.hset("acMap", "AC00061U", "6420");
        jp.hset("acMap", "AC00061D", "5580");
        //#10kv
        jp.hset("acMap", "AC00101U", "10700");
        jp.hset("acMap", "AC00101D", "9300");
        //#20kv
        jp.hset("acMap", "AC00201U", "21400");
        jp.hset("acMap", "AC00201D", "18600");
        //#35kv
        jp.hset("acMap", "AC00351U", "38500");
        jp.hset("acMap", "AC00351D", "31500");
        //#66kv
        jp.hset("acMap", "AC00661U", "72600");
        jp.hset("acMap", "AC00661D", "59400");
        //#110kv
        jp.hset("acMap", "AC01101U", "121000");
        jp.hset("acMap", "AC01101D", "99000");
        //#220kv
        jp.hset("acMap", "AC02201U", "242000");
        jp.hset("acMap", "AC02201D", "198000");
        //#330kv
        jp.hset("acMap", "AC03301U", "363000");
        jp.hset("acMap", "AC03301D", "297000");
        //#500kv
        jp.hset("acMap", "AC05001U", "550000");
        jp.hset("acMap", "AC05001D", "495000");
        //#750kv
        jp.hset("acMap", "AC07501U", "825000");
        jp.hset("acMap", "AC07501D", "675000");
        //#3kv
        jp.hset("acMap", "AC00031U", "3210");
        jp.hset("acMap", "AC00031D", "2700");
        //#110v (2U)
        jp.hset("acMap", "AC01102U", "117.7");
        jp.hset("acMap", "AC01102D", "99");
        //#6v(2U)
        jp.hset("acMap", "AC00062U", "6.42");
        jp.hset("acMap", "AC00062D", "5.4");


        //#6v
        jp.hset("effectiveDataMap", "AC00062U", "7.8");
        jp.hset("effectiveDataMap", "AC00062D", "4.2");
        //#110v
        jp.hset("effectiveDataMap", "AC01102U", "143");
        jp.hset("effectiveDataMap", "AC01102D", "77");
        //#220v
        jp.hset("effectiveDataMap", "AC02202U", "286");
        jp.hset("effectiveDataMap", "AC02202D", "154");
        //#380v
        jp.hset("effectiveDataMap", "AC03802U", "494");
        jp.hset("effectiveDataMap", "AC03802D", "266");
        //#6kv
        jp.hset("effectiveDataMap", "AC00061U", "7800");
        jp.hset("effectiveDataMap", "AC00061D", "4200");
        //#10kv
        jp.hset("effectiveDataMap", "AC00101U", "13000");
        jp.hset("effectiveDataMap", "AC00101D", "7000");
        //#20kv
        jp.hset("effectiveDataMap", "AC00201U", "26000");
        jp.hset("effectiveDataMap", "AC00201D", "14000");
        //#35kv
        jp.hset("effectiveDataMap", "AC00351U", "45500");
        jp.hset("effectiveDataMap", "AC00351D", "24500");
        //#66kv
        jp.hset("effectiveDataMap", "AC00661U", "85800");
        jp.hset("effectiveDataMap", "AC00661D", "46200");
        //#110kv
        jp.hset("effectiveDataMap", "AC01101U", "143000");
        jp.hset("effectiveDataMap", "AC01101D", "77000");
        //#220kv
        jp.hset("effectiveDataMap", "AC02201U", "286000");
        jp.hset("effectiveDataMap", "AC02201D", "154000");
        //#330v
        jp.hset("effectiveDataMap", "AC03301U", "429000");
        jp.hset("effectiveDataMap", "AC03301D", "231000");
        //#500kv
        jp.hset("effectiveDataMap", "AC05001U", "650000");
        jp.hset("effectiveDataMap", "AC05001D", "350000");
        //#750kv
        jp.hset("effectiveDataMap", "AC07501U", "975000");
        jp.hset("effectiveDataMap", "AC07501D", "525000");
        //#500v
        jp.hset("effectiveDataMap", "AC05001U", "650000");
        jp.hset("effectiveDataMap", "AC05001D", "350000");


        //#220v
        jp.hset("yzpbMap", "AC02202U", "235.4");
        jp.hset("yzpbMap", "AC02202D", "198");
        //#380v
        jp.hset("yzpbMap", "AC03802U", "437");
        jp.hset("yzpbMap", "AC03802D", "342");
        //#6kv
        jp.hset("yzpbMap", "AC00061U", "6900");
        jp.hset("yzpbMap", "AC00061D", "5580");
        //#10kv
        jp.hset("yzpbMap", "AC00101U", "11500");
        jp.hset("yzpbMap", "AC00101D", "9300");
        //#20kv
        jp.hset("yzpbMap", "AC00201U", "23000");
        jp.hset("yzpbMap", "AC00201D", "18600");
        //#35kv
        jp.hset("yzpbMap", "AC00351U", "40250");
        jp.hset("yzpbMap", "AC00351D", "31500");
        //#66kv
        jp.hset("yzpbMap", "AC00661U", "75900");
        jp.hset("yzpbMap", "AC00661D", "59400");
        //#110kv
        jp.hset("yzpbMap", "AC01101U", "126500");
        jp.hset("yzpbMap", "AC01101D", "99000");
        //#220kv
        jp.hset("yzpbMap", "AC02201U", "253000");
        jp.hset("yzpbMap", "AC02201D", "198000");
        //#330kv
        jp.hset("yzpbMap", "AC03301U", "379500");
        jp.hset("yzpbMap", "AC03301D", "297000");
        //#500kv
        jp.hset("yzpbMap", "AC05001U", "575000");
        jp.hset("yzpbMap", "AC05001D", "495000");
        //#750kv
        jp.hset("yzpbMap", "AC07501U", "862500");
        jp.hset("yzpbMap", "AC07501D", "675000");


        //#220v
        jp.hset("pbacMap", "AC02202U", "235.4");
        jp.hset("pbacMap", "AC02202D", "198");
        //#380v
        jp.hset("pbacMap", "AC03802U", "406.6");
        jp.hset("pbacMap", "AC03802D", "342");
        //#6kv
        jp.hset("pbacMap", "AC00061U", "6420");
        jp.hset("pbacMap", "AC00061D", "5400");
        //#10kv
        jp.hset("pbacMap", "AC00101U", "10700");
        jp.hset("pbacMap", "AC00101D", "9000");
        //#20kv
        jp.hset("pbacMap", "AC00201U", "21400");
        jp.hset("pbacMap", "AC00201D", "18600");
        //#35kv
        jp.hset("pbacMap", "AC00351U", "37450");
        jp.hset("pbacMap", "AC00351D", "31500");
        //#66kv
        jp.hset("pbacMap", "AC00661U", "70620");
        jp.hset("pbacMap", "AC00661D", "59400");
        //#110kv
        jp.hset("pbacMap", "AC01101U", "117700");
        jp.hset("pbacMap", "AC01101D", "99000");
        //#220kv
        jp.hset("pbacMap", "AC02201U", "235400");
        jp.hset("pbacMap", "AC02201D", "198000");
        //#330kv
        jp.hset("pbacMap", "AC03301U", "353100");
        jp.hset("pbacMap", "AC03301D", "297000");
        //#500kv
        jp.hset("pbacMap", "AC05001U", "535000");
        jp.hset("pbacMap", "AC05001D", "495000");
        //#750kv
        jp.hset("pbacMap", "AC07501U", "802500");
        jp.hset("pbacMap", "AC07501D", "675000");
        //#3kv
        jp.hset("pbacMap", "AC00031U", "3210");
        jp.hset("pbacMap", "AC00031D", "2700");

    }
}
